/**
 * input 删除 控件
 * 
 * 
 * <div class="inline  form-group has-feedback form-group-content" style="width: 150px;">
									<input  placeholder="" class="form-control form-control-ipt" type="text" />
									<span class="glyphicon glyphicon-remove glyphicon-remove-btn form-control-feedback hidden"></span>
								</div>
 */

$(document).ready(function() { 
	 findInputEvent();
});
function  findInputEvent(){
	var arr = $("input[type='text']");
	arr.each(function(i,ele){
		
	if($(ele).hasClass("layer-date")||$(ele).hasClass("nodeleteinput")){
		return;
	}else if($(ele).parent().hasClass("bootstrap-tagsinput")||$(ele).hasClass("tagsinput")){
		return;
	}else if($(ele).hasClass("no-delete")){
		return;
	}
	else{
		
		var thiswidth = $(ele).outerWidth();
		var html = '<div class="inline  has-feedback form-group-content" style="position:relative;"></div>';
		$(ele).wrap(html);
		var htmlspan = '<span class="glyphicon glyphicon-remove glyphicon-remove-btn form-control-feedback hidden"></span>';
		$(ele).parents(".form-group-content").append(htmlspan);
		if($(ele).hasClass("form-input")){
			$(ele).addClass("form-control-ipt");
		}else {
			$(ele).addClass("form-input form-control-ipt");
		}
	}
	})
	inputAction();
}
function inputAction(){
	$(".form-control-ipt").keyup(function(){
			$(this).next(".glyphicon-remove-btn").removeClass("hidden");
	});
	$(".form-control-ipt").hover(function(){
		var flag = $(this).val();
		if(flag){
			$(this).next(".glyphicon-remove-btn").removeClass("hidden");
		}
	});
	$(".glyphicon-remove-btn").on("click",function(){
		 $(this).prev(".form-control-ipt").val('').trigger("change").focus();
	});
	$(document).click(function(){
	    $(".glyphicon-remove-btn").addClass("hidden");
	});
	
	$(".form-group-content").click(function (e) {
	    var evt = e || window.event;
	    evt.stopPropagation();
	});

}